package com.ljf.daily.costmanagement.dto.command;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ljf.common.validation.AddGroup;
import com.ljf.common.validation.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 费用管理明细--新增修改  daily_dat_cost_management_detail
 *
 * @author LJF
 * @since 2025-04-03
 */
@Data
@ApiModel("费用管理明细--新增修改")
public class DailyDatCostManagementDetailCommand implements Serializable {

    @JsonProperty("id")
    @ApiModelProperty(value = "ID")
    @NotNull(message = "ID不能为空", groups = UpdateGroup.class)
    private Long id;

    @JsonProperty("code")
    @ApiModelProperty(value = "编码")
    @Length(message = "编码不能超过6个字符", max = 6)
    @NotNull(message = "编码不能为空", groups = AddGroup.class)
    private String code;

    @JsonProperty("amount")
    @ApiModelProperty(value = "金额")
    @Digits(integer = 6, fraction = 2, message = "金额最多只允许6位整数2位小数")
    @NotNull(message = "金额不能为空", groups = AddGroup.class)
    private BigDecimal amount;

    @JsonProperty("quantity")
    @ApiModelProperty(value = "数量")
    @Digits(integer = 6, fraction = 2, message = "数量最多只允许6位整数2位小数")
    @NotNull(message = "数量不能为空", groups = AddGroup.class)
    private BigDecimal quantity;

    @JsonProperty("remainQuantity")
    @ApiModelProperty(value = "操作数量")
    @NotNull(message = "操作数量不能为空", groups = UpdateGroup.class)
    @Digits(integer = 6, fraction = 2, message = "操作数量最多只允许6位整数2位小数")
    private BigDecimal remainQuantity;

    @JsonProperty("belongDate")
    @ApiModelProperty(value = "归属时间")
    @NotNull(message = "归属时间不能为空", groups = UpdateGroup.class)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date belongDate;

    @JsonProperty("remark")
    @ApiModelProperty(value = "备注")
    @Length(message = "备注不能超过20个字符", max = 20)
    private String remark;

}
